package com.flavors.wan;

import com.lzy.okgo.OkGo;
import com.lzy.okgo.cookie.CookieJarImpl;
import com.lzy.okgo.cookie.store.SPCookieStore;
import com.plat.sdk.MainApplication;
import com.plat.sdk.common.AppHolder;

import okhttp3.OkHttpClient;

/**
 * @author ydong
 */
public class App extends MainApplication {

    private OkHttpClient client;

    @Override
    public void onCreate() {
        super.onCreate();
        initOkgo();
        AppHolder.getInstance().init(getApplicationContext());
    }

    private void initOkgo() {
        OkHttpClient.Builder builder = new OkHttpClient.Builder();
        builder.cookieJar(new CookieJarImpl(new SPCookieStore(this)));//
        client = builder.build();
        OkGo.getInstance().init(this).setOkHttpClient(client);
    }
}
